<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE DeriveGeneric       #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE TypeOperators       #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies        #-}</span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-5"></span><span class="hs-pragma">{-# LANGUAGE GADTs               #-}</span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE FlexibleInstances   #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE StandaloneDeriving  #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE NoImplicitPrelude   #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE PolyKinds           #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes          #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE MagicHash           #-}</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Module      :  Data.Type.Coercion</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- License     :  BSD-style (see the LICENSE file in the distribution)</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- Portability :  not portable</span><span>
</span><span id="line-21"></span><span class="hs-comment">--</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- Definition of representational equality ('Coercion').</span><span>
</span><span id="line-23"></span><span class="hs-comment">--</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- @since 4.7.0.0</span><span>
</span><span id="line-25"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Type.Coercion</span><span>
</span><span id="line-28"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier">Coercion</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-29"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#coerceWith"><span class="hs-identifier">coerceWith</span></a></span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#gcoerceWith"><span class="hs-identifier">gcoerceWith</span></a></span><span>
</span><span id="line-31"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#sym"><span class="hs-identifier">sym</span></a></span><span>
</span><span id="line-32"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#trans"><span class="hs-identifier">trans</span></a></span><span>
</span><span id="line-33"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#repr"><span class="hs-identifier">repr</span></a></span><span>
</span><span id="line-34"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#TestCoercion"><span class="hs-identifier">TestCoercion</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Type.Equality.html"><span class="hs-identifier">Data.Type.Equality</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Eq</span></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Maybe.html"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Enum.html"><span class="hs-identifier">GHC.Enum</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Show.html"><span class="hs-identifier">GHC.Show</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Read.html"><span class="hs-identifier">GHC.Read</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span class="hs-comment">-- | Representational equality. If @Coercion a b@ is inhabited by some terminating</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- value, then the type @a@ has the same underlying representation as the type @b@.</span><span>
</span><span id="line-46"></span><span class="hs-comment">--</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- To use this equality in practice, pattern-match on the @Coercion a b@ to get out</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- the @Coercible a b@ instance, and then use 'coerce' to apply it.</span><span>
</span><span id="line-49"></span><span class="hs-comment">--</span><span>
</span><span id="line-50"></span><span class="hs-comment">-- @since 4.7.0.0</span><span>
</span><span id="line-51"></span><span class="hs-keyword">data</span><span> </span><span id="Coercion"><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span></span><span> </span><span id="local-6989586621679560932"><span class="annot"><a href="#local-6989586621679560932"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679560931"><span class="annot"><a href="#local-6989586621679560931"><span class="hs-identifier hs-type">b</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-52"></span><span>  </span><span id="local-6989586621679561037"><span id="local-6989586621679561038"><span id="Coercion"><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Coercible"><span class="hs-identifier hs-type">Coercible</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561038"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561037"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561038"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561037"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-comment">-- with credit to Conal Elliott for 'ty', Erik Hesselink &amp; Martijn van</span><span>
</span><span id="line-55"></span><span class="hs-comment">-- Steenbergen for 'type-equality', Edward Kmett for 'eq', and Gabor Greif</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- for 'type-eq'</span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-comment">-- | Type-safe cast, using representational equality</span><span>
</span><span id="line-59"></span><span id="local-6989586621679561059"><span id="local-6989586621679561060"><span class="annot"><a href="Data.Type.Coercion.html#coerceWith"><span class="hs-identifier hs-type">coerceWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561060"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561059"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679561060"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679561059"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-60"></span><span id="coerceWith"><span class="annot"><span class="annottext">coerceWith :: forall a b. Coercion a b -&gt; a -&gt; b
</span><a href="Data.Type.Coercion.html#coerceWith"><span class="hs-identifier hs-var hs-var">coerceWith</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span id="local-6989586621679560927"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679560927"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="../../ghc-prim/src/GHC.Prim.html#coerce"><span class="hs-identifier hs-var">coerce</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679560927"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="hs-comment">-- | Generalized form of type-safe cast using representational equality</span><span>
</span><span id="line-63"></span><span class="hs-comment">--</span><span>
</span><span id="line-64"></span><span class="hs-comment">-- @since 4.10.0.0</span><span>
</span><span id="line-65"></span><span id="local-6989586621679561050"><span id="local-6989586621679561051"><span id="local-6989586621679561052"><span class="annot"><a href="Data.Type.Coercion.html#gcoerceWith"><span class="hs-identifier hs-type">gcoerceWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561052"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561051"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Coercible"><span class="hs-identifier hs-type">Coercible</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561052"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561051"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679561050"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679561050"><span class="hs-identifier hs-type">r</span></a></span></span></span></span><span>
</span><span id="line-66"></span><span id="gcoerceWith"><span class="annot"><span class="annottext">gcoerceWith :: forall {k} (a :: k) (b :: k) r.
Coercion a b -&gt; (Coercible a b =&gt; r) -&gt; r
</span><a href="Data.Type.Coercion.html#gcoerceWith"><span class="hs-identifier hs-var hs-var">gcoerceWith</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span id="local-6989586621679560924"><span class="annot"><span class="annottext">Coercible a b =&gt; r
</span><a href="#local-6989586621679560924"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">r
Coercible a b =&gt; r
</span><a href="#local-6989586621679560924"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="hs-comment">-- | Symmetry of representational equality</span><span>
</span><span id="line-69"></span><span id="local-6989586621679561043"><span id="local-6989586621679561044"><span class="annot"><a href="Data.Type.Coercion.html#sym"><span class="hs-identifier hs-type">sym</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561044"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561043"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561043"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561044"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-70"></span><span id="sym"><span class="annot"><span class="annottext">sym :: forall {k} (a :: k) (b :: k). Coercion a b -&gt; Coercion b a
</span><a href="Data.Type.Coercion.html#sym"><span class="hs-identifier hs-var hs-var">sym</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion b a
forall {k} (a :: k) (b :: k). Coercible a b =&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-comment">-- | Transitivity of representational equality</span><span>
</span><span id="line-73"></span><span id="local-6989586621679561033"><span id="local-6989586621679561034"><span id="local-6989586621679561035"><span class="annot"><a href="Data.Type.Coercion.html#trans"><span class="hs-identifier hs-type">trans</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561035"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561034"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561034"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561033"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561035"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561033"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-74"></span><span id="trans"><span class="annot"><span class="annottext">trans :: forall {k} (a :: k) (b :: k) (c :: k).
Coercion a b -&gt; Coercion b c -&gt; Coercion a c
</span><a href="Data.Type.Coercion.html#trans"><span class="hs-identifier hs-var hs-var">trans</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion b c
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion a c
forall {k} (a :: k) (b :: k). Coercible a b =&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span>
</span><span id="line-75"></span><span>
</span><span id="line-76"></span><span class="hs-comment">-- | Convert propositional (nominal) equality to representational equality</span><span>
</span><span id="line-77"></span><span id="local-6989586621679561026"><span id="local-6989586621679561027"><span class="annot"><a href="Data.Type.Coercion.html#repr"><span class="hs-identifier hs-type">repr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679561027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="Data.Type.Equality.html#%3A~%3A"><span class="hs-operator hs-type">Eq.:~:</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561026"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561026"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-78"></span><span id="repr"><span class="annot"><span class="annottext">repr :: forall {k} (a :: k) (b :: k). (a :~: b) -&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#repr"><span class="hs-identifier hs-var hs-var">repr</span></a></span></span><span> </span><span class="annot"><span class="annottext">a :~: b
</span><a href="Data.Type.Equality.html#Refl"><span class="hs-identifier hs-var">Eq.Refl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion a b
forall {k} (a :: k) (b :: k). Coercible a b =&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-81"></span><span id="local-6989586621679560907"><span id="local-6989586621679560909"><span id="local-6989586621679561018"><span id="local-6989586621679561019"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561019"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561018"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-84"></span><span id="local-6989586621679560900"><span id="local-6989586621679560902"><span id="local-6989586621679560904"><span id="local-6989586621679561013"><span id="local-6989586621679561014"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561014"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561013"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span></span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-87"></span><span id="local-6989586621679560880"><span id="local-6989586621679560882"><span id="local-6989586621679560885"><span id="local-6989586621679560888"><span id="local-6989586621679560891"><span id="local-6989586621679560893"><span id="local-6989586621679560895"><span id="local-6989586621679561009"><span id="local-6989586621679561010"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561010"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561009"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span></span></span></span></span></span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-90"></span><span id="local-6989586621679560866"><span id="local-6989586621679560872"><span id="local-6989586621679560875"><span id="local-6989586621679560877"><span id="local-6989586621679561003"><span id="local-6989586621679561004"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Coercible"><span class="hs-identifier hs-type">Coercible</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561004"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561003"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Read.html#Read"><span class="hs-identifier hs-type">Read</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561004"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561003"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span></span></span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-93"></span><span id="local-6989586621679560999"><span id="local-6989586621679561000"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679560850"><span id="local-6989586621679560852"><span id="local-6989586621679560854"><span id="local-6989586621679560856"><span id="local-6989586621679560860"><span id="local-6989586621679560862"><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Coercible"><span class="hs-identifier hs-type">Coercible</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561000"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560999"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Enum.html#Enum"><span class="hs-identifier hs-type">Enum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679561000"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560999"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-94"></span><span>  </span><span id="local-6989586621679560843"><span class="annot"><span class="annottext">toEnum :: Int -&gt; Coercion a b
</span><a href="GHC.Enum.html#toEnum"><span class="hs-identifier hs-var hs-var hs-var hs-var">toEnum</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion a b
forall {k} (a :: k) (b :: k). Coercible a b =&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span>
</span><span id="line-95"></span><span>  </span><span class="annot"><a href="GHC.Enum.html#toEnum"><span class="hs-identifier hs-var">toEnum</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion a b
forall a. String -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.Type.Coercion.toEnum: bad argument&quot;</span></span><span>
</span><span id="line-96"></span><span>
</span><span id="line-97"></span><span>  </span><span id="local-6989586621679560840"><span class="annot"><span class="annottext">fromEnum :: Coercion a b -&gt; Int
</span><a href="GHC.Enum.html#fromEnum"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromEnum</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span></span></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-100"></span><span id="local-6989586621679560832"><span id="local-6989586621679560835"><span id="local-6989586621679560990"><span id="local-6989586621679560991"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Coercible"><span class="hs-identifier hs-type">Coercible</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560991"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560990"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Enum.html#Bounded"><span class="hs-identifier hs-type">Bounded</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560991"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560990"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span class="hs-comment">-- | This class contains types where you can learn the equality of two types</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- from information contained in /terms/. Typically, only singleton types should</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- inhabit this class.</span><span>
</span><span id="line-105"></span><span class="hs-keyword">class</span><span> </span><span id="TestCoercion"><span class="annot"><a href="Data.Type.Coercion.html#TestCoercion"><span class="hs-identifier hs-var">TestCoercion</span></a></span></span><span> </span><span id="local-6989586621679560983"><span class="annot"><a href="#local-6989586621679560983"><span class="hs-identifier hs-type">f</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-106"></span><span>  </span><span class="hs-comment">-- | Conditionally prove the representational equality of @a@ and @b@.</span><span>
</span><span id="line-107"></span><span>  </span><span id="local-6989586621679560986"><span id="local-6989586621679560987"><span id="testCoercion"><span class="annot"><a href="Data.Type.Coercion.html#testCoercion"><span class="hs-identifier hs-type">testCoercion</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679560983"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560987"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679560983"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560986"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560987"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560986"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-110"></span><span id="local-6989586621679560981"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#TestCoercion"><span class="hs-identifier hs-type">TestCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Equality.html#%3A~%3A"><span class="hs-operator hs-type">(Eq.:~:)</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560981"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-111"></span><span>  </span><span id="local-6989586621679560824"><span class="annot"><span class="annottext">testCoercion :: forall (a :: k) (b :: k).
(a :~: a) -&gt; (a :~: b) -&gt; Maybe (Coercion a b)
</span><a href="#local-6989586621679560824"><span class="hs-identifier hs-var hs-var hs-var hs-var">testCoercion</span></a></span></span><span> </span><span class="annot"><span class="annottext">a :~: a
</span><a href="Data.Type.Equality.html#Refl"><span class="hs-identifier hs-var">Eq.Refl</span></a></span><span> </span><span class="annot"><span class="annottext">a :~: b
</span><a href="Data.Type.Equality.html#Refl"><span class="hs-identifier hs-var">Eq.Refl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion a b -&gt; Maybe (Coercion a b)
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion a b
forall {k} (a :: k) (b :: k). Coercible a b =&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span></span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span class="hs-comment">-- | @since 4.10.0.0</span><span>
</span><span id="line-114"></span><span id="local-6989586621679560972"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#TestCoercion"><span class="hs-identifier hs-type">TestCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Equality.html#%3A~~%3A"><span class="hs-operator hs-type">(Eq.:~~:)</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560972"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-115"></span><span>  </span><span id="local-6989586621679560817"><span class="annot"><span class="annottext">testCoercion :: forall (a :: k) (b :: k).
(a :~~: a) -&gt; (a :~~: b) -&gt; Maybe (Coercion a b)
</span><a href="#local-6989586621679560817"><span class="hs-identifier hs-var hs-var hs-var hs-var">testCoercion</span></a></span></span><span> </span><span class="annot"><span class="annottext">a :~~: a
</span><a href="Data.Type.Equality.html#HRefl"><span class="hs-identifier hs-var">Eq.HRefl</span></a></span><span> </span><span class="annot"><span class="annottext">a :~~: b
</span><a href="Data.Type.Equality.html#HRefl"><span class="hs-identifier hs-var">Eq.HRefl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion a b -&gt; Maybe (Coercion a b)
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion a b
forall {k} (a :: k) (b :: k). Coercible a b =&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span></span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-118"></span><span id="local-6989586621679560966"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Data.Type.Coercion.html#TestCoercion"><span class="hs-identifier hs-type">TestCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679560966"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-119"></span><span>  </span><span id="local-6989586621679560803"><span class="annot"><span class="annottext">testCoercion :: forall (a :: k) (b :: k).
Coercion a a -&gt; Coercion a b -&gt; Maybe (Coercion a b)
</span><a href="#local-6989586621679560803"><span class="hs-identifier hs-var hs-var hs-var hs-var">testCoercion</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion a a
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion a b -&gt; Maybe (Coercion a b)
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion a b
forall {k} (a :: k) (b :: k). Coercible a b =&gt; Coercion a b
</span><a href="Data.Type.Coercion.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span></span><span>
</span><span id="line-120"></span></pre></body></html>